#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

vector<vector<int>> yangHuiTriangle(int level)
{
    vector<vector<int>> result{{1}};

    for (int i = 1; i < level; ++i)
    {
        vector<int> tmp(i + 1, 0);

        for (int j = 0; j < i + 1; ++j)
        {
            if (j == 0 || j == i)
            {
                tmp[j] = 1;
            }
            else
            {
                tmp[j] = result[i - 1][j - 1] + result[i - 1][j];
            }
        }

        result.push_back(tmp);
    }

    return result;
}

void cout_nchr(int num, char c)
{
    for(int i = 0; i < num; i++){
        cout<< c;
    }
}

int main(int argc, char const *argv[])
{
    int level = 10;
    /* code */
    auto result = yangHuiTriangle(level);
    
    for (auto v : result)
    {
        cout_nchr(level-v.size(), ' ');
        for (int n : v)
        {
            cout << n << " ";
        }

        cout << endl;
    }
    
    return 0;
}